//
//  MyBranchShowScoreView.m
//  ShangHaiHuDongApp
//
//  Created by 刘应平 on 2017/7/14.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "MyBranchShowScoreView.h"

@interface MyBranchShowScoreView ()
/** 当前积分  */
@property (strong, nonatomic) UILabel  *currentLabel;
/**  number  */
@property (strong, nonatomic) UILabel  *scoreNumber;
/**  线  */
@property (strong, nonatomic) UIView  *underLiane;
/** 背景图片 */
@property (nonatomic, strong) UIImageView *bgImageView;
@end
/**  60  */
@implementation MyBranchShowScoreView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.bgImageView];
        [self addSubview:self.currentLabel];
        [self addSubview:self.scoreNumber];
        [self addSubview:self.underLiane];
        self.currentLabel.sd_layout
        .topSpaceToView(self, 0)
        .leftEqualToView(self)
        .widthIs(90 * [UIScreen zj_screenWScale])
        .heightIs(self.height);
        
        self.scoreNumber.sd_layout
        .leftEqualToView(self)
        .leftSpaceToView(self.currentLabel, 5 * [UIScreen zj_screenWScale])
        .rightEqualToView(self)
        .heightIs(self.height);
        
        self.underLiane.sd_layout
        .bottomEqualToView(self)
        .leftEqualToView(self)
        .rightEqualToView(self)
        .heightIs(1);
        
    }
    return self;
}
- (void)setNumber:(NSString *)number{
    _number = number;
    self.scoreNumber.text = number;
}

- (UILabel *)currentLabel{
    if (!_currentLabel) {
        _currentLabel = ({
            UILabel *label = [UILabel new];
            label.textAlignment = NSTextAlignmentRight;
            label.textColor = [UIColor whiteColor];
            label.backgroundColor = [UIColor clearColor];
            label.font = LYPFONT(17);
            label.text = @"党员积分";
            label;
        });
    }
    return _currentLabel;
}

- (UIImageView *)bgImageView{
    if (_bgImageView == nil){
        _bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height)];
        _bgImageView.contentMode = UIViewContentModeScaleToFill;
        _bgImageView.image = [UIImage imageNamed:@"banner_jifen"];
    }
    return _bgImageView;
}

- (UILabel *)scoreNumber{
    if (!_scoreNumber) {
        _scoreNumber = ({
            UILabel *label = [UILabel new];
            label.textAlignment = NSTextAlignmentLeft;
            label.textColor = [UIColor whiteColor];
            label.backgroundColor = [UIColor clearColor];
            label.font = LYPBOLDFONT(45);
            label.text = @"0";
            label;
        });
    }
    return _scoreNumber;
}

- (UIView *)underLiane{
    if (!_underLiane) {
        _underLiane = [UIView new];
        _underLiane.backgroundColor = [UIColor lightGrayColor];
    }
    return _underLiane;
}
@end
